﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ColonisatorGame
{
    public class GameHUD
    {
        public MenuHaut menuHaut { get; set; }
        public Main fenetrePrincipale { get; set; }
        public MenuInteractions menuInteractions { get; set; }
        public MenuBas menuBas { get; set; }
        public MenuCompteTours menuCompteTours { get; set; }

        private List<DisplayZone> displayZones;

        public GameHUD(Int32 totalWidth, Int32 totalHeigth)
        {
            menuHaut = new MenuHaut(totalWidth, totalHeigth);
            menuBas = new MenuBas(totalWidth, totalHeigth);
            fenetrePrincipale = new Main(totalWidth, totalHeigth);
            menuInteractions = new MenuInteractions(totalWidth, totalHeigth);
            menuCompteTours = new MenuCompteTours(totalWidth, totalHeigth);

            displayZones = new List<DisplayZone>() { menuHaut, menuBas, fenetrePrincipale, menuInteractions, menuCompteTours };
        }

        public void AfficherHUD(SpriteBatch spriteBatch, Texture2D texture)
        {
            spriteBatch.Draw(texture, menuHaut.Cadre, CouleurMenuHaut());
            spriteBatch.Draw(texture, menuBas.Cadre, CouleurMenuBas());
            spriteBatch.Draw(texture, menuInteractions.Cadre, CouleurMenuInter());
            //spriteBatch.Draw(texture, fenetrePrincipale.Cadre, CouleurMain());
        }

        public Color CouleurMenuHaut()
        {
            Color color;
            color = Color.Green;
            color.A = 50;
            return color;
        }

        public Color CouleurMain()
        {
            Color color;
            color = Color.Red;
            color.A = 50;
            return color;
        }

        public Color CouleurMenuBas()
        {
            Color color;
            color = Color.Yellow;
            color.A = 50;
            return color;
        }

        public Color CouleurMenuInter()
        {
            Color color;
            color = Color.Black;
            color.A = 50;
            return color;
        }

        /// <summary>
        /// Donne la zone au dessus de laquelle la souris pointe
        /// </summary>
        /// <param name="mouseRec">la position de la souris</param>
        /// <returns>retourne null si pas d'occurence</returns>
        public DisplayZone GetMouseOveredDisplayZone(Rectangle mouseRec)
        {
            if (this.menuCompteTours.IsMouseOvered(mouseRec))
                return this.menuCompteTours;
            else if (this.menuHaut.IsMouseOvered(mouseRec))
                return this.menuHaut;
            else if (this.menuInteractions.IsMouseOvered(mouseRec))
                return this.menuInteractions;
            else if (this.menuBas.IsMouseOvered(mouseRec))
                return this.menuBas;
            else if (this.fenetrePrincipale.IsMouseOvered(mouseRec))
                return this.fenetrePrincipale;
            else
                return null;
        }
    }
}
